<template>
  <div>
    <el-table :data="list" border v-loading="loading" style="width: 100%">
      <el-table-column prop="name" label="姓名"> </el-table-column>
      <el-table-column prop="idCard" label="身份证号"> </el-table-column>
      <el-table-column prop="moveInAddress" label="迁入地"> </el-table-column>
      <el-table-column prop="address" label="现住址"> </el-table-column>
      <el-table-column prop="moveIn" label="迁入时间"> </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button type="text" @click="goDetail(scope.row)">详情</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { storage } from "../../utils/storage.js";
export default {
  data() {
    return {
      loading: false,
      personList: storage.getStorage("person"),
      list: []
    };
  },
  methods: {
    filterPerson() {
      this.loading = true;
      setTimeout(() => {
        this.list = this.personList.filter(item => item.personType == "2");
        this.loading = false;
      }, 500);
    },
    goDetail(temp) {
      this.$router.push(`/person/detail/${temp.userId}`);
    }
  },
  mounted() {
    this.filterPerson();
  }
};
</script>